---
title: (MODULE_NAME)VectorStore
---

How to use this Python vector store template:

- [ ] Substitute (MODULE_NAME) with the name of the module, e.g. Anthropic, OpenAI, etc. (`command + F` is your friend here)
- [ ] Update links to point to the correct module
- [ ] Update the PyPi/registry package name if needed
- [ ] Update the API key environment variable name if needed

The template starts below this line...

This guide provides a quick overview for getting started with the (MODULE_NAME) [vector store](/oss/integrations/vectorstores#overview). For a detailed listing of all (MODULE_NAME)VectorStore features, paramaters, and configurations, head to the [(MODULE_NAME)VectorStore API reference](link-goes-here).

## Setup

To access the (MODULE_NAME) vector store, you'll need to create a/an (MODULE_NAME) account, get an API key, and install the `langchain-(MODULE_NAME)` integration package.

### Credentials

```python Set API key icon="key"
import getpass
import os

if "(MODULE_NAME)_API_KEY" not in os.environ:
    os.environ["(MODULE_NAME)_API_KEY"] = getpass.getpass("Enter your (MODULE_NAME) API key: ")
```

To enable automated <Tooltip tip="Log each step of a model's execution to debug and improve it">tracing</Tooltip> of your model calls, set your [LangSmith](https://docs.smith.langchain.com/) API key:

```python Enable tracing icon="flask"
os.environ["LANGSMITH_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ")
os.environ["LANGSMITH_TRACING"] = "true"
```

### Installation

The LangChain (MODULE_NAME) integration lives in the `langchain-(MODULE_NAME)` package:

<CodeGroup>
    ```python pip
    pip install -U langchain-(MODULE_NAME)
    ```
    ```python uv
    uv add langchain-(MODULE_NAME)
    ```
</CodeGroup>

---

## Instantiation

Now we can instantiate our model object and generate responses:

```python Initialize vector store icon="database"
from langchain_(MODULE_NAME).vectorstores import (MODULE_NAME)VectorStore

vector_store = (MODULE_NAME)VectorStore(embeddings=embeddings)
```

---

## Manage vector store

### Add items

```python Add documents icon="folder-plus"
from langchain_core.documents import Document

document_1 = Document(page_content="foo", metadata={"source": "https://example.com"})
document_2 = Document(page_content="bar", metadata={"source": "https://example.com"})
document_3 = Document(page_content="baz", metadata={"source": "https://example.com"})
documents = [document_1, document_2, document_3]

vector_store.add_documents(documents=documents, ids=["1", "2", "3"])
```

### Update items

```python Update document by ID icon="pencil"
updated_document = Document(
    page_content="qux", metadata={"source": "https://another-example.com"}
)

vector_store.update_documents(document_id="1", document=updated_document)
```

### Delete items

```python Delete documents by IDs icon="trash"
vector_store.delete(ids=["3"])
```

---

## Query vector store

Once your vector store has been created and the relevant documents have been added you will most likely wish to query it during the running of your chain or agent.

### Directly

Performing a simple similarity search can be done as follows:

```python Similarity search icon="folder-tree"
results = vector_store.similarity_search(
    query="thud", k=1, filter={"source": "https://another-example.com"}
)
for doc in results:
    print(f"* {doc.page_content} [{doc.metadata}]")
```

If you want to execute a similarity search and receive the corresponding scores you can run:

```python Similarity search with scores icon="star-half-stroke"
results = vector_store.similarity_search_with_score(
    query="thud", k=1, filter={"source": "https://example.com"}
)
for doc, score in results:
    print(f"* [SIM={score:3f}] {doc.page_content} [{doc.metadata}]")
```

### By turning into retriever

You can also transform the vector store into a retriever for easier usage in your chains.

```python Create retriever icon="robot"
retriever = vector_store.as_retriever(search_type="mmr", search_kwargs={"k": 1})
retriever.invoke("thud")
```

---

## Usage for retrieval-augmented generation

<Card
    title="(MODULE_NAME) Vector Store RAG Guide"
    href="/oss/langchain/rag"
    icon="magnifying-glass"
    arrow
>
    Guide on how to use this vector store for retrieval-augmented generation (RAG)
</Card>

---

## TODO: Any functionality specific to this vector store

Delete if not relevant.

Look at existing vector store docs for examples, e.g.:

- [Qdrant](/oss/integrations/vectorstores/qdrant)
- [FAISS](/oss/integrations/vectorstores/faiss)
- [Chroma](/oss/integrations/vectorstores/chroma)

Examples:
- <Icon icon="ruler-horizontal" size={16}/> Distance functions
- <Icon icon="chart-simple" size={16}/> Relevance
- <Icon icon="filter" size={16}/> Filtering
- <Icon icon="server" size={16} /> External storage options
- <Icon icon="tags" size={16} /> Indexing
- <Icon icon="code-merge" size={16} /> Merging

---

## API reference

For detailed documentation of all (MODULE_NAME)VectorStore features and configurations, head to the [API reference](link-to-ref-page).
